let $localStorage = {
	setLocalStorage:(key,value,rFun,eFun)=>{
		var value = JSON.stringify(value);
		uni.setStorage({
			key:key,
			data:value,
			success:function(){
				if(typeof rFun == 'function')
					rFun();
			},
			fail() {
				if(typeof eFun == 'function')
					eFun();
			}
		})
	},


	
	getLocalStorage : (key,rFun,eFun)=>{
		uni.getStorage({
			key: key,
			success: function (res) {
				if(typeof rFun == 'function'){
					let reData = res.data;
					if(reData)reData = JSON.parse(reData)
					rFun(reData);//直接是对象，不用转
				}
			},
			fail: function(res){
				if(typeof eFun == 'function')eFun(res);
			}
		});
	},
	

}
let setLocalStorageSync = function(key,value){
		var value = JSON.stringify(value);
		return uni.setStorageSync(key,value);
		console.log(key)
	}
let setLocalStorageSyncdata = function(key){
		let value = uni.getStorageSync(key);
		if(value)
			value = JSON.parse(value);
		return value;
	}
export default {$localStorage,setLocalStorageSync,setLocalStorageSyncdata}